package io.lb.deng.starter;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import lombok.extern.slf4j.Slf4j;

@SpringBootConfiguration
@EnableConfigurationProperties(ProjectProperties.class)
@Slf4j
public class DemoAutoConfiguration {
    
      /**
     * 雪花算法
     * 
     * @param projectProperties
     * @return
     */
    @Bean
    public SnowFlake snowFlake(ProjectProperties projectProperties) {
        log.info("创建SnowFlake");
        return new SnowFlake(projectProperties.getSnowFlakeDataCenterId(), projectProperties.getSnowFlakeMachineId());
    }
}
